package jf.jextn.util;

import java.util.Calendar;
import java.util.Locale;
import java.util.TimeZone;

import jf.jextn.JExtn;

public final class Localization {
    private static final Localization instance = new Localization();

    private Locale locale = Locale.getDefault();

    private TimeZone timeZone = TimeZone.getDefault();

    public Localization() {
    }

    public static Localization get() {
        return instance;
    }

    public static void setLocale(Locale locale, TimeZone timeZone) {
        instance.locale = JExtn.ifNull(locale, Locale.getDefault());
        instance.timeZone = JExtn.ifNull(timeZone, TimeZone.getDefault());
    }

    public Calendar now() {
        Calendar now = Calendar.getInstance(timeZone, locale);

        return now;
    }

    public static Calendar getNow() {
        return get().now();
    }
}
